package com.linwen.javase.juc;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @ClassName _17BlockQueueThread
 * @Description
 * @Author lin
 * @Date 2022/4/24 上午12:28
 * @Version V1.0
 *
 * put 队列满会阻塞
 * take队列空会阻塞
 */
public class _17BlockQueueThread {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(3);
        queue.put("a");
        queue.put("b");
        queue.put("c");
        // queue.put("d");

        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        // System.out.println(queue.take());

    }
}
